
<!DOCTYPE html  [
    <!ENTITY nbsp "&#160;">]>
    <ui:composition template="/layout_dashboard.xhtml"
                    xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:p="http://primefaces.org/ui">
        <ui:param name="onload" value="#{loginController.security('dashboarduser')}"/>



        <ui:define name="Menu">
            <p:panel header="#{loginController.account.username}">
                <h:outputText  value="Name: "/>        
                <h:outputText  value="#{loginController.userdata.name}"  />
                <br/>
                <h:outputText  value="Email:"/>        
                <h:outputText  value=" #{loginController.userdata.EMail}"  />
                <br/>
                <br/>
                <div style="text-align: center">
                    <p:commandButton action="#{loginController.logout()}" value="Logout"/>
                </div>
            </p:panel>
        </ui:define>
        <ui:define name="TopBar">
            <ul>
                <li><a href="../home.xhtml">Homepage</a></li>
                <li><a href="../field/listefield.xhtml">Courses</a></li>
                <li  class="current_page_item"><a href="">Dashboard</a></li>
            </ul>
            <h:panelGroup style="display:block; text-align:right">
                <h:outputLink>Find Courses</h:outputLink>
            </h:panelGroup> 
        </ui:define>

        <ui:define name="Content">
            <h:form>
                <div style="margin-top: 10px">

                    <ui:repeat value="#{dashboardUser.listcourse}" var="course">
                        <p:fieldset legend="#{course.courseName}">
                            <h:panelGrid columns="2" cellpadding="10" >
                                <h:link outcome="#{dashboardUser.redirect_toward_user_course()}">
                                    <p:graphicImage  width="200" height="150"  library="ContentFile" name="#{course.photo}"/>
                                    <f:param name="courseid" value="#{course.idCourse}"/>
                                </h:link>
                                <h:outputText value="#{course.courseDescription}"/>
                                <p:commandButton  value="Unsubscribe" action="#{dashboardUser.unsubscribe(course)}" style="margin-left: 40px"/>
                            </h:panelGrid>

                        </p:fieldset>
                        <br/>
                    </ui:repeat>
                </div>
            </h:form>

        </ui:define>
    </ui:composition>